package com.situ.day2;

import org.junit.Test;

import java.util.Scanner;

public class IfElseDemo {
    @Test
    public void test1() {
        if (3 >= 5) {//false
            System.out.println("true");
        } else {
            System.out.println("false");
        }
    }

    /*
        >=90   <=100      优秀
        >=80    <90       良好
        >=70    <80       一般
        >=60    <70      及格
        <60              不及格
        */
    @Test
    public void test2() {
        //从控制台读取我们输入的值
        Scanner scanner = new Scanner(System.in);
        //int score = 87;
        System.out.println("请输入成绩：");
        int score = scanner.nextInt();
        if (score < 0 || score > 100) {
            System.out.println("成绩非法");
            return;
        }

        if ((score >= 90) && (score <= 100)) {
            System.out.println("优秀");
        } else if (score >= 80 && score < 90) {
            System.out.println("良好");
        } else if (score >= 70 && score < 80) {
            System.out.println("一般");
        } else if (score >= 60 && score < 70) {
            System.out.println("及格");
        } else {
            System.out.println("不及格");
        }

    }
}
